package operations;

import Book.Book;
import Book.Booklist;

import java.util.Scanner;

public class Findoperation implements Ioperations{

    @Override
    public void work(Booklist booklist) {
        System.out.println("查找图书中.....");
        System.out.println("输入你要查找的图书:");
        Scanner scanner = new Scanner(System.in);
        String bookname = scanner.nextLine();
        int currentSize = booklist.getUsedSize();
        for (int i = 0; i < currentSize; i++) {
            Book book = booklist.getBooks(i);
            if(book.getBookname().equals(bookname)){
                System.out.println("找到了:");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有你要找的书！");
    }
}
